import request from '@/api/request'



//微信角色
export function getWxRoles(params) {
  return request({
    url: '/member/wx_role/',
    method: 'GET',
    params
  })
}

export function addWxRole(data) {
  return request({
    url: '/member/wx_role/',
    method: 'POST',
    data
  })
}

export function updateWxRole(data) {
  return request({
    url: `/member/wx_role/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delWxRole(role_id) {
  return request({
    url: `/member/wx_role/${role_id}/`,
    method: 'DELETE',
  })
}
//权限列表
export function getWxPermissions(params) {
  return request({
    url: '/member/wx_permission/',
    method: 'GET',
    params
  })
}


export function getWxRolePermission(params) {
  return request({
    url: '/member/wx_role_permission/',
    method: 'GET',
    params
  })
}

export function getWxAdminPermission(params) {
  return request({
    url: '/member/wx_admin_permission/',
    method: 'GET',
    params
  })
}

export function getWxRetailerList() {
  return request({
    url: '/member/retailer_list/',
    method: 'GET'
  })
}

export function getWxRetailers(params) {
  return request({
    url: '/member/wx_retailer/',
    method: 'GET',
    params
  })
}



export function getWxRetailerById(retailer_id) {
  return request({
    url: `/member/wx_retailer/${retailer_id}/`,
    method: 'GET',
  })
}

export function addWxRetailer(data) {
  return request({
    url: '/member/wx_retailer/',
    method: 'POST',
    data
  })
}

export function updateWxRetailer(data) {
  return request({
    url: `/member/wx_retailer/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delWxRetailer(retailer_id) {
  return request({
    url: `/member/wx_retailer/${retailer_id}/`,
    method: 'DELETE',
  })
}

export function delWxRetailerImage(image_id) {
  return request({
    url: `/member/wx_retailer_image/${image_id}/`,
    method: 'DELETE',
  })
}


export function uploadRetailerImage(data) {
  return request({
    url: `/member/wx_image_upload/`,
    method: 'POST',
    data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  })
}

export function uploadContactImage(data) {
  return request({
    url: `/member/wx_contact_upload/`,
    method: 'POST',
    data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  })
}

export function getWxRetailerInfo(params) {
  return request({
    url: '/member/wx_retailer_info/',
    method: 'GET',
    params,
  })
}
// 赠送积分
export function WxBonusPoint(data) {
  return request({
    url: '/member/wx_bonus_point/',
    method: 'POST',
    data
  })
}
// 取消积分
export function WxBonusPointCancel(data) {
  return request({
    url: '/member/wx_bonus_point_cancel/',
    method: 'POST',
    data
  })
}

// 查看积分赠送情况
export function getWxBonusPointList(params) {
  return request({
    url: '/member/wx_bonus_point_list/',
    method: 'GET',
    params
  })
}
// 删除赠送积分
export function delWxBonusPoint(id) {
  return request({
    url: `/member/wx_bonus_point_list/${id}/`,
    method: 'DELETE',
  })
}
// 员工授权
export function WxEmployeeAuth(data) {
  return request({
    url: '/member/wx_employee_auth/',
    method: 'POST',
    data
  })
}
// 消费积分
export function WxConsumePoint(data) {
  return request({
    url: '/member/wx_consume_point/',
    method: 'POST',
    data
  })
}
// 消费积分列表
export function getWxConsumePointList(params) {
  return request({
    url: '/member/wx_consume_point_list/',
    method: 'GET',
    params
  })
}

export function getRechargeRecord(params) {
  return request({
    url: '/wechat/wx_recharge_record/',
    method: 'GET',
    params
  })
}

export function getRechargeRecordById(id) {
  return request({
    url: `/wechat/wx_recharge_record/${id}/`,
    method: 'GET',
  })
}


export function getEmployees(params) {
  return request({
    url: '/member/wx_employee/',
    method: 'GET',
    params
  })
}

export function getEmployeeById(emp_id) {
  return request({
    url: `/member/wx_employee/${emp_id}/`,
    method: 'GET',
  })
}

export function addEmployee(data) {
  return request({
    url: '/member/wx_employee/',
    method: 'POST',
    data
  })
}

export function updateEmployee(data) {
  return request({
    url: `/member/wx_employee/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function deleteEmployee(params) {
  return request({
    url: `/member/wx_employee/${params.id}/`,
    method: 'DELETE',
    params
  })
}
//统计
export function getBonusStats(params) {
  return request({
    url: '/member/wx_bonus_stats/',
    method: 'GET',
    params
  })
}

export function getRechargeStats(params) {
  return request({
    url: '/wechat/wx_recharge_stats/',
    method: 'GET',
    params
  })
}

export function getWxUserList() {
  return request({
    url: '/member/wx_user_list/',
    method: 'GET'
  })
}